package com.gochart.controller;

import com.gochart.bean.TestTable;
import com.gochart.dao.TestTableDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;
import java.io.*;

@Controller
@RequestMapping("/test")
public class HelloController {

	@Autowired
	private TestTableDao testTableDao;


	@RequestMapping(value = "method",method = RequestMethod.GET)
	public String printWelcome(ModelMap model,HttpServletRequest request) {
		model.addAttribute("message", "Hello world!");
		System.out.println("model = " + model);


		request.setAttribute("myp","myp1");
		TestTable table = testTableDao.getById(0);
		System.out.println("getAttributeNames = " + request.getAttributeNames().toString());

		return "hello";
	}
}